package com.coai.common.exception

/**
 * 业务异常基类
 */
open class BusinessException(
    message: String,
    val code: String? = null,
    cause: Throwable? = null
) : RuntimeException(message, cause)

/**
 * 资源未找到异常
 */
class ResourceNotFoundException(
    message: String,
    code: String? = "RESOURCE_NOT_FOUND"
) : BusinessException(message, code)

/**
 * 参数验证异常
 */
class ValidationException(
    message: String,
    code: String? = "VALIDATION_ERROR"
) : BusinessException(message, code)

/**
 * 权限不足异常
 */
class UnauthorizedException(
    message: String = "Unauthorized",
    code: String? = "UNAUTHORIZED"
) : BusinessException(message, code)

/**
 * 禁止访问异常
 */
class ForbiddenException(
    message: String = "Forbidden",
    code: String? = "FORBIDDEN"
) : BusinessException(message, code)

/**
 * 冲突异常
 */
class ConflictException(
    message: String,
    code: String? = "CONFLICT"
) : BusinessException(message, code)
